<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>图片代理测试</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      padding: 20px;
    }
    .test-container {
      margin-bottom: 30px;
    }
    img {
      max-width: 200px;
      border: 1px solid #ddd;
    }
    .result {
      margin-top: 10px;
      font-size: 14px;
    }
    .success {
      color: green;
    }
    .error {
      color: red;
    }
  </style>
</head>
<body>
  <h1>图片代理服务测试</h1>
  
  <div class="test-container">
    <h3>测试百度图片 (403错误的图片)</h3>
    <p>原始URL: https://bkimg.cdn.bcebos.com/pic/a71ea8d3fd1f4134970aaa85244482cad1c8a686f08f</p>
    <p>通过代理:</p>
    <img id="test1" src="http://localhost:3001/api/image-proxy?url=https://bkimg.cdn.bcebos.com/pic/a71ea8d3fd1f4134970aaa85244482cad1c8a686f08f" alt="测试图片1">
    <div id="result1" class="result"></div>
  </div>
  
  <div class="test-container">
    <h3>测试另一个图片</h3>
    <img id="test2" src="http://localhost:3001/api/image-proxy?url=https://img2.doubanio.com/view/photo/s_ratio_poster/public/p2614884828.jpg" alt="测试图片2">
    <div id="result2" class="result"></div>
  </div>
  
  <script>
    // 图片加载状态检测
    document.getElementById('test1').onload = function() {
      document.getElementById('result1').textContent = '图片加载成功！';
      document.getElementById('result1').className = 'result success';
    };
    
    document.getElementById('test1').onerror = function() {
      document.getElementById('result1').textContent = '图片加载失败！';
      document.getElementById('result1').className = 'result error';
    };
    
    document.getElementById('test2').onload = function() {
      document.getElementById('result2').textContent = '图片加载成功！';
      document.getElementById('result2').className = 'result success';
    };
    
    document.getElementById('test2').onerror = function() {
      document.getElementById('result2').textContent = '图片加载失败！';
      document.getElementById('result2').className = 'result error';
    };
  </script>
</body>
</html>